package cate.game.train.furniture.msg;

import cate.common.annotation.OperationSetter;
import cate.common.table.d.GDOperation;
import cate.common.util.GameResult;
import cate.game.GameBody;
import cate.game.client.ClientContext;
import cate.game.client.msg.ClientMsg;
import cate.game.client.msg.MsgConfig;
import cate.game.client.msg.MsgInput;
import cate.game.client.msg.id.MsgIdBTrain;
import easy.java.dev.note.NoteField;

@ClientMsg(title = "手办洗练")
@OperationSetter(GDOperation.FURNITURE_RECAST)
public class FurnitureRecastReq implements MsgInput {
    @NoteField(value = "手办uid")
    public String uid;
    @NoteField(value = "英雄ID", detail = "要给哪一个英雄脱装备")
    public String heroUid;
    @NoteField(value = "位置")
    public byte pos;

    @NoteField("是否使用洗练道具")
    public boolean useItem;
    @NoteField("选择的阵营, 不选不传或传0")
    public byte camp;
    @NoteField("选择的职业，不选不传或传0")
    public byte job;
    @NoteField("选择的阵营属性，不选不传或传0")
    public int campAttrId;
    @NoteField("选择的职业属性，不选不传或传0")
    public int jobAttrId;

    @Override
    public void execute(GameBody game, ClientContext cc) {
        GameResult<Void> r = game.train.furniture.recast(
                cc.getRole(),
                uid,
                heroUid,
                pos,
                useItem,
                camp,
                job,
                campAttrId,
                jobAttrId);
        if (!r.ok()) {
            game.notice.message(cc.getRole(), r);
        }
    }

    @Override
    public MsgConfig conf() {
        return MsgIdBTrain.FURNITURE_RECAST_REQ;
    }
}
